#!/usr/bin/env python3
"""
启动Web界面进行测试
"""
import uvicorn
import sys
import os

# 添加项目根目录到Python路径
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

def main():
    from core.config import get_settings
    settings = get_settings()
    
    print("启动MinerU文档解析系统Web界面...")
    print(f"访问地址: http://localhost:{settings.web_port}/web/")
    print("测试用户: testuser / testpass123")
    print("管理员用户: admin / admin123")
    print("按 Ctrl+C 停止服务器")
    
    # 初始化数据库
    from core.database import init_db
    init_db()
    
    # 启动服务器
    uvicorn.run(
        "main:app",
        host=settings.host,
        port=settings.web_port,
        reload=True,
        log_level=settings.log_level.lower()
    )

if __name__ == "__main__":
    main()